<include file="./VMSTpl/Admin/header.html" /> 
  <div class="container"> 
   <h2>{$title}</h2>
   <div id="main" class="col-md-6"> 
    <form role="form" method="post" onsubmit="return check()"> 
     <div class="form-group"> 
      <label for="unit">单位</label> 
      <select name="unit" class="form-control" required>
      <volist name="data" id="vo">
		<option value='{$vo['id']}'>{$vo['id']}.{$vo['name']}</option>
	  </volist>
	  </select>
     </div> 
     <div class="form-group" > 
      <label for="no">飞机号码</label> 
      <input type="text" class="form-control" name="no" id="no" placeholder="0001(四位数字)" required /> 
     </div> 
	 <div class="form-group"> 
      <label for="revi">翻修次数</label> 
      <select name="revi" class="form-control" required>
		<option value='1'>1</option>
		<option value='2'>2</option>
		<option value='3'>3</option>
	  </select>
     </div> 
	 <div class="form-group"> 
      <label for="man">出厂号码</label> 
      <input type="text" class="form-control" name="man" id="man" placeholder="0000001(七位数字)" required /> 
     </div> 
	 <div class="form-group"> 
      <label for="date">进厂日期</label> 
      <input type="text" class="form-control"  name="date" id="date" required /> 
     </div> 
     <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button> 
	 <a href="__ROOT__/Admin/Index" class="btn btn-default btn-lg btn-block">返回</a> 
    </form> 
   </div> 
  </div> 
<include file="./VMSTpl/Admin/tailer.html" />
  <script>
  	$(document).ready(function(){
		$("input[name='date']").cxCalendar({ 
			type:"yyyy-mm-dd",
		}); 
	})
  	
	function check(){
		var unit = $("select[name='unit']").val();
		var no = $("input[name='no']").val();
		var revi = $("select[name='revi']").val();
		var man = $("input[name='man']").val();
		var date = $("input[name='date']").val();
		var reg=/^\d{4}$/;
		if(!reg.test(no)){
			alert("飞机号码格式有误！");
			$("input[name='no']").focus();
			return false;
		}
		
		reg=/^\d{7}$/;
		if(!reg.test(man)){
			alert("出厂号码格式有误！");
			$("input[name='man']").focus();
			return false;
		}
		
		reg=/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/;
		if(!reg.test(date)){
			alert("日期格式有误！");
			$("input[name='date']").focus();
			return false;
		}
	}
  </script>
   